<?php

//连接数据库
	$db = mysqli_connect('127.0.0.1','root','','libo');
	//判断是否连接成功
	if (!mysqli_connect_errno($db)){
		//成功
		// echo "连接数据库成功";
		//判断是插入请求还是查询请求
			mysqli_query($db,'SET NAMES UTF8');
			
			$name = $_POST['name'];
			$password1 = $_POST['password1'];
			$qq = $_POST['qq'];
			$email =$_POST['email'];

			$sql = "INSERT INTO register(name,password1,qq,email) VALUES('$name','$password1','$qq','$email')";
			//执行

			 $result=mysqli_query($db,$sql);
			 //判断插入成功
			 if ($result) {
			 	echo json_encode(['code'=>1,'msg'=>'success']);
			 }else{
			 	echo json_encode(['code'=>0,'msg'=>'failed']);
			 }
	}	


?>